package com.cssy.xxkj.logic.dao.impl;

import com.cssy.xxkj.logic.dao.LogicWarehouseHistoryDAO;
import com.cssy.xxkj.logic.entity.LogicWarehouseHistoryDO;
import com.plat.exception.SyBaseException;
import com.plat.helper.SearchConditions;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import java.util.List;

/**
 * 数据访问对象实现类
 * @since 2015-01-04
 */
public class LogicWarehouseHistoryDAOImpl extends SqlMapClientDaoSupport implements LogicWarehouseHistoryDAO {

    /**
     * 插入数据
     * @param logicWarehouseHistoryDO
     * @return 插入数据的主键
     */
    public String insertLogicWarehouseHistoryDO(LogicWarehouseHistoryDO logicWarehouseHistoryDO) {
        Object id = getSqlMapClientTemplate().insert("LogicWarehouseHistory.insert", logicWarehouseHistoryDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicWarehouseHistoryDO
     * @return 查出的记录数
     */
    public Integer countLogicWarehouseHistoryDOByExample(LogicWarehouseHistoryDO logicWarehouseHistoryDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicWarehouseHistory.countByDOExample", logicWarehouseHistoryDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicWarehouseHistoryDO
     * @return 受影响的行数
     */
    public Integer updateLogicWarehouseHistoryDO(LogicWarehouseHistoryDO logicWarehouseHistoryDO) {
        int result = getSqlMapClientTemplate().update("LogicWarehouseHistory.update", logicWarehouseHistoryDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicWarehouseHistoryDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicWarehouseHistoryDO> findListByExample(LogicWarehouseHistoryDO logicWarehouseHistoryDO) {
        List<LogicWarehouseHistoryDO> list = getSqlMapClientTemplate().queryForList("LogicWarehouseHistory.findListByDO", logicWarehouseHistoryDO);
        return list;
    }

    /**
     * 根据主键获取logicWarehouseHistoryDO
     * @param id
     * @return logicWarehouseHistoryDO
     */
    public LogicWarehouseHistoryDO findLogicWarehouseHistoryDOByPrimaryKey(String id) {
        LogicWarehouseHistoryDO logicWarehouseHistoryDO = (LogicWarehouseHistoryDO) getSqlMapClientTemplate().queryForObject("LogicWarehouseHistory.findByPrimaryKey", id);
        return logicWarehouseHistoryDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicWarehouseHistoryDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicWarehouseHistory.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicWarehouseHistoryDO> findListByCondition(
			SearchConditions scs) throws SyBaseException {
		List<LogicWarehouseHistoryDO> list= getSqlMapClientTemplate().queryForList("LogicWarehouseHistory_ex.findLogicWarehouseHistoryDOByCondition", scs);
		return list;
	}

}
